function wxConfig(url = null, callback) {

    axios.get(url).then((res) => {
        if (!res) {
            return;
        }
        const params = res.data.data;
        let jsApiList = [
            'chooseImage',
            'updateTimelineShareData',
            'showMenuItems',
            'updateAppMessageShareData',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareQZone',
            'hideMenuItems',
            'chooseWXPay',
            'getLocalImgData',
            'getLocation'
        ];
        console.log('res.data.data', res.data.data);
        wx.config({
            debug: false,
            appId: params.app_id,
            timestamp: params.timestamp,
            nonceStr: params.nonce_str,
            signature: params.signature,
            jsApiList: jsApiList,
        });

        wx.checkJsApi({
            jsApiList: jsApiList,
            success: (res) => {
                console.log(res);
                // 以键值对的形式返回，可用的api值true，不可用为false
                // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}

                callback && callback();
            }
        });
    });
};

function setShare(menuList, params = null) {
    let menus = [
        'menuItem:share:appMessage',
        'menuItem:share:timeline',
        'menuItem:share:qq',
        'menuItem:share:weiboApp',
        'menuItem:favorite',
        'menuItem:share:facebook',
        'menuItem:share:QZone',
        'menuItem:editTag',
        'menuItem:delete',
        'menuItem:copyUrl',
        'menuItem:originPage',
        'menuItem:readMode',
        'menuItem:openWithQQBrowser',
        'menuItem:openWithSafari',
        'menuItem:share:email',
        'menuItem:share:brand'
    ]

    menus = menus.filter((item) => {
        const findIndex = menuList.findIndex((menu) => item === menu);

        if (findIndex === -1) {
            return item;
        }
    });

    console.log('menus', menus);

    //需在用户可能点击分享按钮前就先调用
    wx.ready(() => {
        // 批量显示功能按钮接口
        wx.hideMenuItems({
            menuList: menus
        })

        let link = '';
        let imgUrl = '';
        let title = '';
        let desc = '';
        window.share_config = {
            share: {
                link,
                imgUrl,
                title,
                desc,
                success: function (rr) {
                    // 分享成功回调 可以在这儿加 alert 打印 便于调试
                    alert.log('成功' + JSON.stringify(rr))
                },
                cancel: function (tt) {
                    // 分享失败回调 可以在这儿加 alert 打印 便于调试
                    alert.log('失败' + JSON.stringify(tt));
                }
            },
        }
        if (params) {
            window.share_config.share = params;
        }

        const callback = () => {
        }

        // config
            console.log('window.share_config', window.share_config);
            // wx.onMenuShareAppMessage(window.share_config.share); // 微信好友
            // wx.onMenuShareTimeline(window.share_config.share); // 微信朋友圈
            // wx.onMenuShareQQ(window.share_config.share); // QQ
            wx.updateAppMessageShareData(window.share_config.share);
            wx.updateTimelineShareData(window.share_config.share);
    });

        wx.error(function (res) {
            console.log("wx.error res", res);
        });
};
